import { request, uploadFileRequest } from '@/utils/request';

export interface FileInfo {
  id: string;
  filename: string;
  file_size: number;
  upload_time: string;
  description?: string;
}

// 移除 FileListResponse 接口
export const fileAPI = {
  upload: (file: File, description?: string) => 
    uploadFileRequest('/api/v1/files/upload', file, { description }),
    
  getList: () => 
    request<FileInfo[]>('/api/v1/files/files'),  // 直接使用 FileInfo 数组类型
    
  delete: (fileId: string) => 
    request(`/api/v1/files/files/${fileId}`, { method: 'DELETE' })
};